<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="Generator" content="ALORK 20150428.01" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
<title><?php echo $this->_var['page_title']; ?></title>
<link rel="stylesheet" href="./public/my_style.css" />
<?php echo $this->smarty_insert_scripts(array('files'=>'./../js/region.js,./../js/jquery.js,./../js/jquery.json-1.3.js,./../js/jquery.flexslider-min.js')); ?>
<script type="text/javascript" src="public/iScroll_4.2.5.js"></script>


</head>
<body >
<?php echo $this->fetch('library/baidutongji.lbi'); ?>
  <?php echo $this->fetch('library/user_head.lbi'); ?>
<div id="goods_big_box">
  <?php if ($this->_var['color']): ?>
<div class="color_b">
  <div class="color_list" id="wrapper">
    <ul class="color_msg" id="scroller" >
      <?php $_from = $this->_var['color']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'color');if (count($_from)):
    foreach ($_from AS $this->_var['color']):
?>
      <li goods_id="<?php echo $this->_var['goods_id']; ?>" attr_id="<?php echo $this->_var['color']['id']; ?>">
        <div class="color" style="background:<?php echo $this->_var['color']['color']; ?>"></div>
        <div class="color_name"><?php echo $this->_var['color']['label']; ?></div>
        <div class="color_num">
          <span class="cut"></span>
          <input type="text" name="color_number" class="color_number"  stock="<?php echo $this->_var['color']['goods_number']; ?>" value="0"/>
          <span class="add" ></span>
        </div>
      </li>
      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
    </ul>
  </div>
  <div class="color_bottom" id="color_black" >
    <div class="confirm" onclick="$('.color_b').slideUp('show'); myScroll.destroy();$('#goods').show();">确认</div>
    <div class="back" onclick="$('.color_b').slideUp('show'); myScroll.destroy();$('#goods').show();">返回</div>
    <div class="bottom_border"></div>
  </div>
</div>
<?php endif; ?>

<div id="goods" >
 
  <div class="goods_pic">
    <a href="goods_note.php?id=<?php echo $this->_var['goods_id']; ?>">
      <div class="goods_note"  >
        +图文介绍
      </div>
    </a>
    <div class="flexslider" style="float: left; width: 100%; height: 100%; position: relative;overflow: hidden;"> 
      <ul class="slides" styke="width:1000%">
        <?php $_from = $this->_var['pic']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'pic_0_73005300_1443347441');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['pic_0_73005300_1443347441']):
?>
        <li> <img src="./../<?php echo $this->_var['pic_0_73005300_1443347441']; ?>"></li>
      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
      </ul>
    </div>
  </div>

  <div class="goods_info ">
      <div class="goods_name"><?php echo $this->_var['goods_info']['goods_name']; ?></div>
    <?php if ($this->_var['goods_info']['is_promote'] && $this->_var['goods_info']['gmt_end_time']): ?>

      <div class="eleven_price" style="background:#e41414;">
        <img src="Background/price_b3.png" alt="" width="100%" style="min-width: 320px;"/>
        
        <span class="one" ><span style="font-size:12px;">￥&nbsp;</span>&nbsp;&nbsp;&nbsp;<?php echo $this->_var['goods_info']['promote_price']; ?></span>
        <span class="two" >市场价<?php echo $this->_var['goods_info']['market_price']; ?></span>
        <span class="three">闪购价</span>
      </div>

      <!-- <div class="baoyou"></div> -->
      <!-- <span style="color:#ab0409; font-size:14px; display:block; padding:0px 0px 3px 0px; font-weight: bolder;">520当天买100送50,买300送150,买500送300</span> -->
     
    <?php elseif ($this->_var['goods_info']['is_new'] == 1 && $this->_var['goods_info']['is_best'] == 0): ?>
          <div class="by_your_price_price">
            <img src="../mobile/Icon/m_by_your_price_price_bg.png" alt="" alt="" width="100%" style="min-width: 290px;"/>
            <div class="left">
              <span class="text">由你定价</span>
              <span class="shop_price"><span style="font-size: 12px;">￥</span><span class="money"><?php echo $this->_var['goods_info']['shop_price']; ?></span></span>
            </div>
            <div class="right">
              <span class="text">原价</span>
              <span class="market_price"><?php echo $this->_var['goods_info']['market_price']; ?></span>
            </div>
            <div class="discount"><?php echo $this->_var['goods_info']['discount']; ?>折</div>
          </div>

    <?php elseif ($this->_var['goods_info']['preferential_price'] > 0 && $this->_var['goods_info']['preferential_num'] > 0): ?>
      <div class="eleven_price">
        <img src="Background/price_b.png" alt="" width="100%" style="min-width: 290px;"/>      
        <div class="market_price">正品市场价 <span style="text-decoration: line-through;"><?php echo $this->_var['goods_info']['market_price']; ?></span></div>
        <div class="shop_price">
        	<?php if (( $this->_var['user_array']['agent_rank'] == 1 || $this->_var['user_array']['agent_rank'] == 2 ) && $this->_var['goods_info']['agent_price'] > 0): ?>
    		<span title="分销价">分销价&nbsp;&nbsp;￥</span><?php echo $this->_var['goods_info']['agent_price']; ?>
    		<?php else: ?>
    		<span>鸡蛋价&nbsp;&nbsp;￥</span><?php echo $this->_var['goods_info']['shop_price']; ?>
    		<?php endif; ?>
          
        </div>
        <div class="preferential_num">购买数量&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;≥3</div>
        <div class="preferential">优惠价 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;￥<span><?php echo $this->_var['goods_info']['preferential_price']; ?></span></div>
      </div>

      <!-- <div class="baoyou"></div> -->
      <!-- <span style="color:#ab0409; font-size:14px; display:block; padding:0px 0px 3px 0px; font-weight: bolder;">520当天买100送50,买300送150,买500送300</span> -->
    <?php else: ?>
     <div class="eleven_price eleven_price2">
      <img src="Background/price_b2.png" alt="" width="100%" style="min-width: 290px;"/>      
      <div class="market_price">
        正品市场价　<span style="text-decoration: line-through;"><?php echo $this->_var['goods_info']['market_price']; ?></span>
      </div>
      <div class="shop_price">
        <span>鸡蛋优惠价　￥</span><?php echo $this->_var['goods_info']['shop_price']; ?>
      </div>
    </div>
    <!-- <div class="baoyou"></div> -->
    <!-- <span style="color:#ab0409; font-size:14px; display:block; padding:0px 0px 3px 0px; font-weight: bolder;">520当天买100送50,买300送150,买500送300</span> -->
    <?php endif; ?>


    <?php if ($this->_var['related_goods']): ?>
    <div class="property"><a class="title">属性  |</a>
              <?php $_from = $this->_var['related_goods']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'item');if (count($_from)):
    foreach ($_from AS $this->_var['item']):
?>

              <a <?php if ($this->_var['goods_id'] != $this->_var['item']['goods_id']): ?>href="<?php echo $this->_var['item']['url']; ?>"<?php endif; ?> class="left spec<?php if ($this->_var['goods_id'] == $this->_var['item']['goods_id']): ?> this<?php endif; ?>" title="<?php echo $this->_var['item']['goods_name']; ?>"><?php echo $this->_var['item']['goods_brief']; ?></a>

              <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
    </div>
    <?php endif; ?>


  </div>


<div id="address_box" class="none">
<div id="region_bg" onclick="$('#address_box').hide();">
</div>
<form action="alork_region.php" method="post" name="theForm" id="theForm" onsubmit="return alork_region(this)">
<div class="address_list one">
    <select name="country" id="selCountries_<?php echo $this->_var['sn']; ?>" onchange="region.changed(this, 1, 'selProvinces_<?php echo $this->_var['sn']; ?>')" style="border:1px solid #ccc;display:none;">
        <?php $_from = $this->_var['country_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'country');if (count($_from)):
    foreach ($_from AS $this->_var['country']):
?>
        <option value="<?php echo $this->_var['country']['region_id']; ?>" <?php if ($this->_var['consignee']['country'] == $this->_var['country']['region_id']): ?>selected<?php endif; ?>><?php echo $this->_var['country']['region_name']; ?></option>
        <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
    </select>
        <div class="select_text_ui" style="min-width: 2.5em;"><?php if ($this->_var['consignee']['province_name']): ?><?php echo $this->_var['consignee']['province_name']; ?><?php else: ?>请选择省<?php endif; ?></div>
        <select name="province" id="selProvinces_<?php echo $this->_var['sn']; ?>" onchange="$(this).parent().find('.select_text_ui').html($(this).find('option:selected').text());region.changed(this, 2, 'selCities_<?php echo $this->_var['sn']; ?>')" style="width:100%">
            <option value="0">请选择省</option>
            <?php $_from = $this->_var['province_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'province');if (count($_from)):
    foreach ($_from AS $this->_var['province']):
?>
                <option value="<?php echo $this->_var['province']['region_id']; ?>"  <?php if ($this->_var['consignee']['province'] == $this->_var['province']['region_id']): ?>selected<?php endif; ?>><?php echo $this->_var['province']['region_name']; ?></option>
            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
        </select>
</div>
<div class="address_list two">
        <div class="select_text_ui" style="min-width: 2.5em;"><?php if ($this->_var['consignee']['city_name']): ?><?php echo $this->_var['consignee']['city_name']; ?><?php else: ?>请选择市<?php endif; ?></div>
        <select name="city" id="selCities_<?php echo $this->_var['sn']; ?>" onchange="$(this).parent().find('.select_text_ui').html($(this).find('option:selected').text());region.changed(this, 3, 'selDistricts_<?php echo $this->_var['sn']; ?>')" style="border:1px solid #ccc;">
          <option value="0">请选择市</option>
          <?php $_from = $this->_var['city_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'city');if (count($_from)):
    foreach ($_from AS $this->_var['city']):
?>
          <option value="<?php echo $this->_var['city']['region_id']; ?>" <?php if ($this->_var['consignee']['city'] == $this->_var['city']['region_id']): ?>selected<?php endif; ?>><?php echo $this->_var['city']['region_name']; ?></option>
          <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
        </select>
</div>
<div class="address_list three">
        <div class="select_text_ui" style="min-width: 2.5em;"><?php if ($this->_var['consignee']['district_name']): ?><?php echo $this->_var['consignee']['district_name']; ?><?php else: ?>请选择区<?php endif; ?></div>
        <select name="district" id="selDistricts_<?php echo $this->_var['sn']; ?>" onchange="$(this).parent().find('.select_text_ui').html($(this).find('option:selected').text()); $('#theForm').submit(); " style="border:1px solid #ccc;">
            <option value="0">请选择区</option>
            <?php $_from = $this->_var['district_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'district');if (count($_from)):
    foreach ($_from AS $this->_var['district']):
?>
            <option value="<?php echo $this->_var['district']['region_id']; ?>" <?php if ($this->_var['consignee']['district'] == $this->_var['district']['region_id']): ?>selected<?php endif; ?>><?php echo $this->_var['district']['region_name']; ?></option>
            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
        </select>
</div>
<input type="hidden" value="<?php echo $this->_var['url']; ?>" name="url" />
<script type="text/javascript">
var process_request = "<?php echo $this->_var['lang']['process_request']; ?>";
</script>
<?php echo $this->smarty_insert_scripts(array('files'=>'./../js/utils.js,./../js/region.js,./../js/user.js,./../js/common.js,./../js/jquery.js,./../js/jquery.json-1.3.js,./../js/transport.js')); ?>
</form>
<script type="text/javascript">
    // 选择区域
    function alork_region(obj){
        if($("select[name='province']").val()=='0'){
            return false;
        }
        if($("select[name='city']").val()=='0'){
            return false;
        }
        if($("select[name='district']").val()=='0'){
            return false;
        }
        return true;
    }
            $(function(){
            $('#index_region .select_ui').each(function(){
                $(this).find('.select_text_ui').text($(this).find('option:selected').text());
            });
        });
</script>
</div>





<form action="javascript:addToCart(<?php echo $this->_var['goods_info']['goods_id']; ?>)" method="post" name="ECS_FORMBUY" id="ECS_FORMBUY" class="ECS_FORMBUY">


  <div class="goods_buy">
    
<?php if ($this->_var['color']): ?>

<div id="color_buy" >

      <div id="spec_name"  >选择颜色购买</div>
      <div class="selected">
        <div class="title">已选颜色  |</div>
        <?php $_from = $this->_var['color']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'color');if (count($_from)):
    foreach ($_from AS $this->_var['color']):
?>
        <li class="none"> <span class="name"><?php echo $this->_var['color']['label']; ?></span> <span class="selected_num">0</span>  <span class="close">×</span></li>
        <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
      </div>
<!--       <span style="color:#ab0409; overflow: hidden; font-size:16px; display:block; width: 100%; line-height: 20px; height: 40px;">全场买100送50,买300送150,买500送300</span> -->
    <div>配送至: <span class="address_one" onclick="$('#address_box').show();"><?php echo $this->_var['address']; ?></span></div>
    <?php if ($this->_var['daodansong_is']): ?>
    <div class="address">
    <div>鸡蛋配送：以下集训地区可<span style="color:#85030a">半日送达</span>，由导弹快递配送</div>
    <div class="missile" onclick="$('#daodansong_box').show();"><?php if ($_SESSION['consignee']['daodansong']['area_name']): ?><?php echo $_SESSION['consignee']['daodansong']['area_name']; ?><?php else: ?>选择集训区<?php endif; ?></div>
    </div>
    <?php endif; ?>
      <div class="collect" onclick="collect(<?php echo $this->_var['goods_id']; ?>);"> 收藏</div>

    <a <?php if (! $_SESSION['user_id']): ?> href="user.php"<?php else: ?> href="javascript:alork_addcart(<?php echo $this->_var['goods_info']['goods_id']; ?>,1)" <?php endif; ?> class="black_red_box"><div class="black_red">立即购买</div></a>
    <a <?php if (! $_SESSION['user_id']): ?> href="user.php"<?php else: ?> href="javascript:alork_addcart(<?php echo $this->_var['goods_info']['goods_id']; ?>,0)" <?php endif; ?> class="black_red_box"><div class="black_red">加入购物车</div></a>
    <div class="phone_buy">
        <a href="http://wpa.b.qq.com/cgi/wpa.php?ln=2&uin=800099584" target="_blank" class="qq">联系客服</a><a href="tel:4008089317" class="phone">电话订购</a>
    </div>


<script type="text/javascript">
                //     // /*拖动关闭颜色选择*/
              var obj = document.getElementById('color_black');
              obj.addEventListener('touchmove', function(event) {
                 event.preventDefault();// 阻止浏览器默认事件，重要 
              }, false);
              obj.addEventListener('touchstart', function (e) {
                      nStartY = e.targetTouches[0].pageY;
                      nStartX = e.targetTouches[0].pageX;
                  });
              obj.addEventListener('touchend', function (e) {
                      nChangY = e.changedTouches[0].pageY;
                      nChangX = e.changedTouches[0].pageX;
                      text=nChangY-nStartY;
                      if(text<0){
                        $('.color_b').slideUp('show');
                        $('#goods').show();
                        myScroll.destroy();
                      }
                  });
              $(".color_number").keyup(function(){  //keyup事件处理
              $(this).val($(this).val().replace(/\D|^0/g,''));  
                    }).bind("paste",function(){  //CTR+V事件处理 
              $(this).val($(this).val().replace(/\D|^0/g,''));  
              }).css("ime-mode", "disabled");  //CSS设置输入法不可用
              $(".color_number").blur(function(){
                var val=parseInt($(this).val());
                var num=parseInt($(this).attr('num'));
                if(!$(this).val())<?php echo $this->_var['(this)']['val(0);']; ?>
                if(val>num){
                 $(this).val(num);
                 point('商品只剩下'+num+'件');
                }
              });
              var t1 = null;//这个设置为全局
              $('.add').click(function(){
                 if (t1 == null){
                      t1 = new Date().getTime();
                  }else{       
                      var t2 = new Date().getTime();
                      if(t2 - t1 < 350){
                          t1 = t2;
                          return;
                      }else{
                          t1 = t2;
                      }
                  }
                var index=$(this).parents('li').index();
                var num=$(this).siblings('.color_number').val();
                var stock=$(this).siblings('.color_number').attr('stock');
                var new_num=parseInt(num)+1;
                if(stock==0){
                    point('该颜色已售完');
                }
                else if(new_num>stock){
                  new_num=stock;
                  point('商品只剩下'+stock+'件');
                }
                else{
                $(this).siblings('.color_number').val(new_num);
                $(".selected li").eq(index).show().find('.selected_num').html(new_num);
                }
              });
            
              $('.cut').click(function(){
                if (t1 == null){
                      t1 = new Date().getTime();
                  }else{       
                      var t2 = new Date().getTime();
                      if(t2 - t1 < 350){
                          t1 = t2;
                          return;
                      }else{
                          t1 = t2;
                      }
                  }
                var index=$(this).parents('li').index();
                var num=$(this).siblings('.color_number').val();
                var new_num=parseInt(num)-1;
                if(new_num<=0){
                  new_num=0;
                  $(".selected li").eq(index).hide();
                }
                $(this).siblings('.color_number').val(new_num);
                $(".selected li").eq(index).find('.selected_num').html(new_num);
              });

              $('.close').click(function(){
                var index=($(this).parents('li').index()-1);
                $('.color_msg').find('li').eq(index).find('.color_number').val(0);
                $(this).parents("li").hide();
              });

              var myScroll;
              $('#spec_name').click(function(){
                var height=$(window).height();
                var height2=$('.color_msg').height();
                $('#goods').hide();
                $('.color_b').height(height);
                $('.color_list').height(height-129);
                $('.color_b').slideDown("slow");

                $('body,html').animate({scrollTop:0},400);
                loaded();
              });
              function loaded() {
                myScroll = new iScroll('wrapper', {
                  snap  :false,
                  momentum: false,
                  vScrollbar :false,
                  hScrollbar: false,
                  topOffset: 0,
                 });
              }
</script>

</div>


<?php else: ?>
    
    <div id="num_box">
          <div class="num">数量 
          <input name="number" id="cart_num" type="hidden"  value="1">
          </div>
        <div class="number_list" id="wrapper">
          <ul id="scroller">
          <?php $_from = $this->_var['stock']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'stock_0_73270000_1443347441');if (count($_from)):
    foreach ($_from AS $this->_var['stock_0_73270000_1443347441']):
?>
          <li <?php if ($this->_var['stock_0_73270000_1443347441'] == 1): ?> class="now"<?php endif; ?>><?php echo $this->_var['stock_0_73270000_1443347441']; ?></li>
         <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
          </ul>
        </div>
    </div>

    <script type="text/javascript">
      var width=$("#num_box").width()-$("#num_box").find('.num').width()-20; 
      $("#wrapper").width(width);
      var length=$("#scroller li").length;
      var move_width=length*($("#scroller li").width()+2);
      $("#scroller").width(move_width);
      $("#scroller li").click(function(){
      $(this).addClass('now').siblings().removeClass('now');
      $('#cart_num').val($(this).text());
      });
      var myScroll;
      function loaded() {
        myScroll = new iScroll('wrapper', {
          snap: true,
          momentum: false,
          hScrollbar: false,
         });
      }
      document.addEventListener('DOMContentLoaded', loaded, false);
    </script>
<!--         <span style="color:#ab0409; overflow: hidden; font-size:16px; display:block; width: 100%; line-height: 20px; height: 40px;">全场买100送50,买300送150,买500送300</span> -->
        <div>配送至: <span class="address_one" onclick="$('#address_box').show();"><?php echo $this->_var['address']; ?></span></div>
        <?php if ($this->_var['daodansong_is']): ?>
        <div class="address">
        <div>鸡蛋配送：以下集训地区可<span style="color:#85030a">半日送达</span>，由导弹快递配送</div>
        <div class="missile" onclick="$('#daodansong_box').show();"><?php if ($_SESSION['consignee']['daodansong']['area_name']): ?><?php echo $_SESSION['consignee']['daodansong']['area_name']; ?><?php else: ?>选择集训区<?php endif; ?></div>
        </div>  
        <?php endif; ?> 
        <div class="collect" onclick="collect(<?php echo $this->_var['goods_id']; ?>);"> 收藏</div>
            <a <?php if (! $_SESSION['user_id']): ?> href="user.php"<?php else: ?> href="javascript:alork_addcart(<?php echo $this->_var['goods_info']['goods_id']; ?>,1)" <?php endif; ?>  class="black_red_box"><div class="black_red">立即购买</div></a>
            <a <?php if (! $_SESSION['user_id']): ?> href="user.php"<?php else: ?> href="javascript:alork_addcart(<?php echo $this->_var['goods_info']['goods_id']; ?>,0)" <?php endif; ?> class="black_red_box"><div class="black_red">加入购物车</div></a>
            <div class="phone_buy">
                <a href="http://wpa.b.qq.com/cgi/wpa.php?ln=2&uin=800099584" target="_blank" class="qq">联系客服</a><a href="tel:4008089317" class="phone">电话订购</a>
            </div>
<?php endif; ?>
  </div>
</form>


</div>




<div id="box_list">
  用户评论
</div>
<div class="box" id="ECS_COMMENT">
<?php echo $this->fetch('library/comments.lbi'); ?>
</div>

<?php echo $this->fetch('library/page_foot2.lbi'); ?>
<script type="text/javascript">

/* 立即购买（待定） */
  function checkout(id){
    if($("#color_buy").length>0){
    // 颜料
      var goods_id  = '';
      var spec_arr  = '';
      var number    = '';//总数量
      $(".color_msg li").each(function(){
        if($(this).find('input').val() > 0){
          var num       = $(this).find('.color_number').val();              //单个数量
          var stock     = $(this).find('.color_number').attr('stock');      //单位库存
          var new_stock = parseInt(stock) - parseInt(num);                  //新库存
          $(this).find('.color_number').attr('stock',new_stock);
          goods_id      += $(this).attr('goods_id') + '-';
          spec_arr      += $(this).attr('attr_id') + '-';
          number        += $(this).find('input').val() + '-';
          $(this).find('.color_number').val(0);
          $('.selected').find('li').hide();
        }
      });
      if(number==""){
        point('请选择颜色购买');
        return false;
      }
      imme_checkout_pigment(goods_id,'0',spec_arr,number);
    }
    else{
      imme_checkout(id,0);
    }
  }

/* 加入购物车 */
  function alork_addcart(id,num){
    if($("#color_buy").length>0){

      var goods_id  = '';
      var spec_arr  = '';
      var number    = '';//总数量
      $(".color_msg li").each(function(){
        if($(this).find('input').val() > 0){
          var num       = $(this).find('.color_number').val();              //单个数量
          var stock     = $(this).find('.color_number').attr('stock');      //单位库存
          var new_stock = parseInt(stock) - parseInt(num);                    //新库存
          $(this).find('.color_number').attr('stock',new_stock);
          goods_id      += $(this).attr('goods_id') + '-';
          spec_arr      += $(this).attr('attr_id') + '-';
          number        += $(this).find('input').val() + '-';
          $(this).find('.color_number').val(0);
          $('.selected').find('li').hide();
        }
      });
      if(number==""){
        point('请选择颜色购买');
        return false;
      }
      addToCart(goods_id,spec_arr,number,'',num);
    }
    else{
      addToCart(id,'',$('#cart_num').val(),'',num);
    }

  }








function point(text){
   $("#point").remove();
  var height=parseInt($(window).height());
  var width=parseInt($(window).width());
  $("#goods_big_box").append("<div id='point'>"+text+"</div>");
  $("#point").css({"top":((height/2)-20),"left":((width/2)-50)});
  $("#point").fadeOut(2000);
}
</script>



<script type="text/javascript">
$(window).load(function() {
  $('.flexslider').flexslider({
    animation: "slide",
    controlNav: true,
    animationLoop: false,
    slideshow: true,
  });
});
</script>



</div>
</body>
</html>